package com.elitel.frame.base.service.impl;

import java.util.List;

import javax.annotation.Resource;

import com.elitel.frame.main.entity.vo.ExecuteSqlInfoVo;
import com.elitel.frame.main.entity.vo.SingleTableInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.elitel.frame.base.service.CfgExtsqlService;
import com.elitel.frame.main.dao.BaseSqlFieldTypeMapper;
import com.elitel.frame.main.dao.BaseSqlconfigMapper;
import com.elitel.frame.main.dao.CfgExtsqlMapper;
import com.elitel.frame.main.dao.ext.ExtBaseSqlconfigMapper;
import com.elitel.frame.main.entity.BaseSqlFieldType;
import com.elitel.frame.main.entity.CfgExtsql;

@Service
public class CfgExtsqlServiceImpl implements CfgExtsqlService{

	@Autowired
	private CfgExtsqlMapper cfgExtsqlMapper;

	@Autowired
	private BaseSqlFieldTypeMapper baseSqlFieldTypeMapper;

	@Resource

	private ExtBaseSqlconfigMapper extBaseSqlconfigMapper;
	@Override
	public CfgExtsql selectCfgSqlByPrimary(String guid) {
		CfgExtsql cfgExtsql = cfgExtsqlMapper.selectByPrimaryKeys(guid);
		List<CfgExtsql> list = cfgExtsqlMapper.selectAll();
		return cfgExtsql;
	}

	@Override
	public List<String> selectBaseSqlField(String serviceID) {
		List<String> list= extBaseSqlconfigMapper.selectBaseSqLField(serviceID);
		return list;
	}

	@Override
    public int insertBaseSqlFieldType(BaseSqlFieldType baseSqlFieldType){
		return baseSqlFieldTypeMapper.insertBaseSqlFieldType(baseSqlFieldType);
	}

    // delete by serviceId
	@Override
    public boolean deleteByServiceId(String serviceId){
		return baseSqlFieldTypeMapper.deleteByServiceId(serviceId);
	}

    // find by serviceId
	@Override
    public List<BaseSqlFieldType> findByServiceId(String serviceId){
		return baseSqlFieldTypeMapper.findByServiceId(serviceId);
	}

	@Override
	public List<CfgExtsql> findAllScriptSql() {
		return cfgExtsqlMapper.findAllScriptSql();
	}

    @Override
    public List<ExecuteSqlInfoVo> selectByServiceCodes(List<String> serviceCodes) {
		return cfgExtsqlMapper.selectByServiceCodes(serviceCodes);
    }


}
